/*
 * DxfDIMENSION.java
 *
 * Created on 6 de Dezembro de 2007, 10:28
 *
 * Modified on 08/24/2011 - 02:00 PM by Adriano
 * Included the attribute @Override to inherited methods
 */

package importadorDXF;

import mathematics.Point3D;

/**
 *
 * @author rafaelbuck
 * @author Adriano
 */
public class DxfDIMENSION extends DxfEntity
{

    @Override
    public boolean setGroup(short grpNr, float fval)
    {
        switch(grpNr)
        {
        case 10: // '\n'
        case 20: // '\024'
        case 30: // '\036'
            if(reference0 == null)
                reference0 = new Point3D();
            setCoord(reference0, grpNr / 10, fval);
            return true;

        case 11: // '\013'
        case 21: // '\025'
        case 31: // '\037'
            if(textMiddle == null)
                textMiddle = new Point3D();
            setCoord(textMiddle, grpNr / 10, fval);
            return true;

        case 12: // '\f'
        case 22: // '\026'
        case 32: // ' '
            setCoord(insertPoint, grpNr / 10, fval);
            return true;

        case 13: // '\r'
        case 23: // '\027'
        case 33: // '!'
            if(reference3 == null)
                reference3 = new Point3D();
            setCoord(reference3, grpNr / 10, fval);
            return true;

        case 14: // '\016'
        case 24: // '\030'
        case 34: // '"'
            if(reference4 == null)
                reference4 = new Point3D();
            setCoord(reference4, grpNr / 10, fval);
            return true;

        case 15: // '\017'
        case 25: // '\031'
        case 35: // '#'
            if(reference5 == null)
                reference5 = new Point3D();
            setCoord(reference5, grpNr / 10, fval);
            return true;

        case 16: // '\020'
        case 26: // '\032'
        case 36: // '$'
            if(reference6 == null)
                reference6 = new Point3D();
            setCoord(reference6, grpNr / 10, fval);
            return true;

        case 40: // '('
            lineLength = fval;
            return true;

        case 50: // '2'
            rotation = (float)(((double)fval / 180D) * 3.1415926535897931D);
            return true;

        case 51: // '3'
            horizontal = (float)(((double)fval / 180D) * 3.1415926535897931D);
            return true;

        case 52: // '4'
            helpRot = (float)(((double)fval / 180D) * 3.1415926535897931D);
            return true;

        case 53: // '5'
            textRot = (float)(((double)fval / 180D) * 3.1415926535897931D);
            return true;
        }
        return super.setGroup(grpNr, fval);
    }

    @Override
    public boolean setGroup(short grpNr, int ival)
    {
        switch(grpNr)
        {
        case 70: // 'F'
            type = (short)ival;
            return true;
        }
        return super.setGroup(grpNr, ival);
    }

    @Override
    public boolean setGroup(short grpNr, String str)
    {
        switch(grpNr)
        {
        case 1: // '\001'
            text = str;
            return true;

        case 2: // '\002'
            blockName = str;
            return true;

        case 3: // '\003'
            style = str;
            return true;
        }
        return super.setGroup(grpNr, str);
    }

    @Override
    public void convert(DxfConverter converter, DxfFile dxf, Object collector)
    {
        converter.convert(this, dxf, collector);
    }

    public final Point3D getInsertPoint()
    {
        return insertPoint;
    }

    public final Point3D getReferencePoint0()
    {
        return reference0;
    }

    public final Point3D getTextMiddle()
    {
        return textMiddle;
    }

    public final String getBlockName()
    {
        return blockName;
    }

    public final String getStyleName()
    {
        return style;
    }

    public final short getType()
    {
        return type;
    }

    public final String getText()
    {
        return text;
    }

    public final Point3D getReferencePoint3()
    {
        return reference3;
    }

    public final Point3D getReferencePoint4()
    {
        return reference4;
    }

    public final Point3D getReferencePoint5()
    {
        return reference5;
    }

    public final Point3D getReferencePoint6()
    {
        return reference6;
    }

    public final float getLineLength()
    {
        return lineLength;
    }

    public final float getRotation()
    {
        return rotation;
    }

    public final float getHorizontal()
    {
        return horizontal;
    }

    public final float getHelpRotation()
    {
        return helpRot;
    }

    public final float getTextRotation()
    {
        return textRot;
    }

    /** Creates a new instance of DxfDIMENSION */
    public DxfDIMENSION()
    {
        insertPoint = new Point3D();
    }

    protected Point3D insertPoint;
    protected Point3D reference0;
    protected Point3D textMiddle;
    protected String blockName;
    protected String style;
    protected short type;
    protected String text;
    protected Point3D reference3;
    protected Point3D reference4;
    protected Point3D reference5;
    protected Point3D reference6;
    protected float lineLength;
    protected float rotation;
    protected float horizontal;
    protected float helpRot;
    protected float textRot;
}